<template>
	<view class="msglist">
		<view class="list">
			<view class="msg">
				<view class="title">{{msgdetails.title}}</view>
				<view class="time">发布时间：{{msgdetails.createdTime}}</view>
				<view class="nr">{{msgdetails.msg}}</view>
			</view>
		</view>
	</view>
</template>
<script>
import { uniIcons } from '@dcloudio/uni-ui';
import msg from '../../../servers/news/msg.js';
import dateFormat from '../../../common/dateFormat.js';
export default {
	data() {
		return {
		msgdetails:'',
	    list: [],
		id:0
		};
	},
	mounted() {
		this.id  = uni.getStorageSync('msg_id')||this.$route.query.msg_id
		console.log(this.id);
		if(this.id){
			this.getDate( this.id)
		}
	},
	methods:{
		getDate(id){
			msg.msgdetails(id).then(res => {
				this.msgdetails= res.data 
				console.log(res.data)
				// this.msgdetails.createdTime = dateFormat.dateFormat('Y-m-d H:M:S',new Date(res.data.createdTime))
				})
				.catch(err => {
					console.log(new Error('请检查网络后重试'));
				});
		}
	}
};
</script>

<style lang="less" scoped>
page {
	background: #ffffff;
}
.msglist {
	position: relative;
	.list {
		// position: absolute;
		// width: 100%;
		// top: 80rpx;
		// bottom: 0;
		background: #fff;
		.msg {
			padding: 20rpx;
			font-size: 28rpx;
			.title{
				font-size: 32rpx;
			}
			.time{
				font-size: 28rpx;
				color: #999;
				margin: 10rpx 0;
			}
		}
	}
}
</style>
